#!/bin/sh /etc/rc.common

START=80
STOP=10
USE_PROCD=1
PROG=/bin/idc_energy

#校验参数的函数
validate_idc_energy_section() {
        uci_validate_section idc_energy conf "${1}" \
                'device:string' \
                'speed:string'
}
#启动函数
start_service() {
        local device speed is_center
        #读取两个参数到 rip和rport中
        validate_idc_energy_section energy || {
                echo "validation failed"
                return 1
        }
	#启动可执行服务程序
        procd_open_instance
        procd_set_param command $PROG
        procd_set_param respawn
        procd_set_param stderr 1
        procd_set_param stdout 1
        procd_close_instance
}
#停止函数
stop_service()
{
        service_stop ${PROG}
}

#服务触发函数
service_triggers()
{
        procd_add_reload_trigger "idc_energy"
        procd_add_validation validate_idc_energy_section
}

